import Vue from 'vue'
import App from './App.vue'
import less from 'less'
Vue.use(less)
import Vant from 'vant';
import 'vant/lib/index.css';
Vue.use(Vant)

import Vuex from "vuex"
Vue.use(Vuex)

import router from './router/router.js'

import { Lazyload } from 'vant';
Vue.use(Lazyload);

import { Toast } from 'vant';

Vue.use(Toast);

Vue.config.productionTip = false

const store=new Vuex.Store({
	state:{
		username:"登录",
		password:'',
		searchVal:'',
		// $store.state.user,
		commodity: [{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a055f11968694b17a200bfaed0e0eb35.jpg?style=st6",
				name: "甘宁",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a7950ebf638c43bb8a20f73c0552da41.jpg?style=st6",
				name: "姜子牙",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a9f8c02a43174ca7a17cd5494ecbab6c.png?style=st6",
				name: "虎生金秋",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/c129ceab5df44f0cbb30c4b87ade869a.png?style=st6",
				name: "车载红利",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
		],
		commodity2:[{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a055f11968694b17a200bfaed0e0eb35.jpg?style=st6",
				name: "甘宁",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a7950ebf638c43bb8a20f73c0552da41.jpg?style=st6",
				name: "姜子牙",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/a9f8c02a43174ca7a17cd5494ecbab6c.png?style=st6",
				name: "虎生金秋",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/c129ceab5df44f0cbb30c4b87ade869a.png?style=st6",
				name: "车载红利",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
			{
				src: "https://static.ibox.art/file/oss/test/image/nft-goods/06afe2a395d44216a416a891076cb03a.jpg?style=st6",
				name: "丹凤",
				author: "ibox",
				price: '18000'
			},
		],
	},
	mutations:{
		setState(state,value){
			state.username=value
			console.log(value)
		}
		//@click="$store.commit('setState','321')"
		,
		setStateSearch(state,value){
			console.log(value)
			state.commodity2 = state.commodity.filter(function(item) {
			    return item.name.indexOf(value)!=-1
			})
			console.log(state.commodity2)
			
		}
	}
})

new Vue({
  router,
  store,
  render: h => h(App),
  
}).$mount('#app')

